//此js文件放置鼠标右键相关功能函数：隐藏显示菜单，菜单项内容，修改、移动、权限、统计等功能函数

var menuskin = "skin0"; // skin0, or skin1
var display_url = 0; // Show URLs in status bar?
F_over=F_out=in_ID=out_ID=null
topmenu = false;
n4 = (document.layers)?1:0;
e4 = (document.all)?1:0; 

function hidemenuie5() {
	if(document.getElementById("ie5menu")!=null){
		document.getElementsByTagName("body")[0].removeChild(document.getElementById("ie5menu"));
	}
	if(document.getElementById("showtablist")!=null&&!showtablist){
		document.getElementsByTagName("body")[0].removeChild(document.getElementById("showtablist"));
	}
	if(document.getElementById("showtablistbg")!=null&&!showtablist){
		document.getElementsByTagName("body")[0].removeChild(document.getElementById("showtablistbg"));
	}
document.body.onclick = null;
}

function hideshowtablist() {
document.body.onclick = null;
}

function highlightie5() {
	if (event.srcElement.className == "menuitems") {
		event.srcElement.style.backgroundColor = "#006051";
		event.srcElement.style.color = "white";
		if (display_url)
			window.status = event.srcElement.url;
   }
}

function lowlightie5() {
	if (event.srcElement.className == "menuitems") {
		event.srcElement.style.backgroundColor = "";
		event.srcElement.style.color = "black";
		window.status = "";
   }
}

function highlighttl() {
	if (event.srcElement.className == "listitems") {
		event.srcElement.className = "listitems_";
		if (display_url)
			window.status = event.srcElement.url;
   }
}

function lowlighttl() {
	if (event.srcElement.className == "listitems_") {
		event.srcElement.className = "listitems";
		window.status = "";
   }
}

function jumptoie5() {
if (event.srcElement.className == "menuitems") {
if (event.srcElement.getAttribute("target") != null)
window.open(event.srcElement.url, event.srcElement.getAttribute("target"));
else
window.location = event.srcElement.url;
   }
}

function menuIn(n) {  //菜单隐藏
	var menu = document.getElementById("D"+n).style;
	var menuH = document.getElementById("D"+n).offsetHeight;
	if(n4) { 
		clearTimeout(out_ID) 
		if( menu.top > menuH*-1+25+10 ) { 
		menu.top -= 8 
		in_ID = setTimeout("menuIn('"+n+"')", 1) 
	} else if( menu.top > menuH*-1+25 ) { 
		menu.top-- 
		in_ID = setTimeout("menuIn('"+n+"')", 1) 
		} 
	} else { 
		clearTimeout(out_ID);
		if( menu.pixelTop > menuH*-1+25+10 ) { 
			menu.pixelTop -= 9;
			in_ID = setTimeout("menuIn('"+n+"')", 1);
		} else if( menu.pixelTop > menuH*-1+25 ) { 
			menu.pixelTop--;
			in_ID = setTimeout("menuIn('"+n+"')", 1);
		} 
	} 
} 

function menuOut(n) {  //菜单显示
	var menu = document.getElementById("D"+n).style;
	var menuH = document.getElementById("D"+n).offsetHeight;
	if(n4) { 
		clearTimeout(in_ID) 
		if( menu.top < -10) { 
			menu.top += 4 
			out_ID = setTimeout("menuOut('"+n+"')", 1) 
		} else if( menu.top < 0) { 
			menu.top++ 
			out_ID = setTimeout("menuOut('"+n+"')", 1) 
		} 

	} else { 
		clearTimeout(in_ID);
		if( menu.pixelTop < -10) { 
			menu.pixelTop += 6;
			out_ID = setTimeout("menuOut('"+n+"')", 1);
		} else if( menu.pixelTop < 0 ) { 
			menu.pixelTop++;
			out_ID = setTimeout("menuOut('"+n+"')", 1);
		} 
	} 
} 
function fireOver(n) { 
	clearTimeout(F_out) 
	F_over = setTimeout("menuOut('"+n+"')", 10) 
} 

function fireOut(n) { 
	clearTimeout(F_over) 
	F_out = setTimeout("menuIn('"+n+"')", 10) 
} 

function initmenu() { 
	addmenutorighttop();
	if(n4) { 
		menu = document.D1;
		menuH = menu.document.Height;
		menu.top = menu.document.height*-1+25;
		menu.onmouseover = menuOut;
		menu.onmouseout = menuIn;
		menu.visibility = "visible";
	} else if(e4) { 
		menu = D1.style;
		menuH = D1.offsetHeight;
		D1.style.pixelTop = D1.offsetHeight*-1+25;
		document.all.goto1.onclick = new Function("showTopMenu(1)");
		//topback.onmouseout = fireOut;
		D1.style.visibility = "visible";
	} 
} 
initmenu();
function addmenutorighttop(){
	var h=CreateEl("div","D1","topmenu");
	if(userlevel==1){
		h.innerHTML="<div id=\"topmenubar\"><div onclick=\"alert(1);\">修复错误</div><div onclick=\"dofix();\">消除重复</div></div><span id=\"topback\" title=\"打开后台管理系统&nbsp;&raquo;\">后台管理系统&nbsp;<img id=\"goto1\" align=\"absmiddle\" src=\"/javascripts/dep_manage/images/goto.gif\"/></span>";
	}else{
		h.innerHTML="<div id=\"topmenubar\">测试<br></div><span id=\"topback\" title=\"打开后台管理系统&nbsp;&raquo;\">后台管理系统&nbsp;<img id=\"goto1\" align=\"absmiddle\" src=\"/javascripts/dep_manage/images/goto.gif\"/></span>";
	}
	document.getElementById("topright").appendChild(h);
}
function inittablist() { 
	addtablisttorightbottom();
	if(n4) { 
		menu = document.D2;
		menuH = menu.document.Height;
		menu.top = menu.document.height*-1+25;
		menu.onmouseover = menuOut;
		menu.onmouseout = menuIn;
		menu.visibility = "visible";
	} else if(e4) { 
		menu = D2.style;
		menuH = D2.offsetHeight;
		D2.style.pixelTop = D2.offsetHeight*-1+25;
		document.all.goto2.onclick = new Function("showTopMenu(2)");
		//topback.onmouseout = fireOut;
		D2.style.visibility = "visible";
	} 
} 
//inittablist();
function addtablisttorightbottom(){
	var h=CreateEl("div","D2","tablist");
	h.innerHTML="<div id=\"topmenubar\"></div><span id=\"topback\" title=\"打开后台管理系统&nbsp;&raquo;\">后台管理系统&nbsp;<img id=\"goto2\" align=\"absmiddle\" src=\"/javascripts/dep_manage/images/goto.gif\"/></span>";
	document.getElementById("content").appendChild(h);
}
function showTopMenu(n){
	if(topmenu){
		fireOut(n);
		document.getElementById("goto"+n).src="/javascripts/dep_manage/images/goto.gif";
		topmenu = false;
	}else{
		fireOver(n);
		document.getElementById("goto"+n).src="/javascripts/dep_manage/images/gotob.gif";
		topmenu = true;
	}
}
